id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String Operationscombine1

prev  |  next  |  chance

s[-1] is the last character of a string

def combine1(s1, s2):
    s3 = s1[0] + s1[-1]
    s4 = s2[0] + s2[-1]
    result = s3 + s4
    return result
Function Call  Return Value
combine1('Car', 'wash')
combine1('Hello', ' world')
combine1('5', '8')
combine1('Snow', 'ball')
combine1('Rain', 'boots')
combine1('Reading', 'bat')
combine1('AAA', 'Hi')
combine1('Hi', 'there')
combine1(' ', ' ')

Experiment with this code on Gitpod.io

⬅ Back